/**
 * @file 打印显眼的调试信息
 */
const theme = {
  primary: '#4697ec',
  info: '#667c89',
  success: '#67ac5b',
  warn: '#ed9135',
  error: '#ed5f59',
  group: '#F2789F',
}

const log = (color, text, ...args) => {
  console.group(
    `%c${text}`,
    `background: ${color};border-radius: 4px;color: #fff;font-size: 13px;font-weight: bold;padding: 0 8px;margin: 4px;line-height: 22px;`
  )
  console.log(...args)
  console.groupEnd()
}

const elog = (text, ...args) => {
  log(theme.primary, text, ...args)
}
elog.primary = elog
elog.info = (text, ...args) => {
  log(theme.info, text, ...args)
}
elog.success = (text, ...args) => {
  log(theme.success, text, ...args)
}
elog.warn = (text, ...args) => {
  log(theme.warn, text, ...args)
}
elog.error = (text, ...args) => {
  log(theme.error, text, ...args)
}
elog.group = groupName => {
  console.group(
    `%c==== ${groupName} ====`,
    `border: 1px solid ${theme.group};border-radius: 4px;color: ${theme.group};font-size: 12px;font-weight: bold;padding: 0 8px;margin: 4px; 12%);line-height: 20px;`
  )
}
elog.groupEnd = () => {
  console.groupEnd()
}

export { elog }
